<?php
namespace  app\admin\controller;

use app\admin\AdminCommon;
use think\Db;

class Gives extends AdminCommon
{
    public  function  getindex()
    {
        $data=Db::table('tp_gives')->alias('tgs')
            ->field('tgs.id,tgs.create_time,tu.user_name,tu.user_pic,tg.goods_name,tg.goods_pic')
            ->join('tp_user tu','tgs.user_id=tu.id')
            ->join('tp_goods tg','tgs.goods_id=tg.id')
            ->select();
        $i=0;
        foreach($data as $v)
        {
            $data[$i]['user_pic']='/uploads/user_pic/'.$v['user_pic'];
            $data[$i]['goods_pic']='/uploads/goods_pic/'.$v['goods_pic'];
            $data[$i]['create_time']=date('Y-m-d',$v['create_time']);
            $i++;
        }
        return $this->fetch('/collections/index',['data'=>$data,'b'=>1]);
    }
}
?>